/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$.fn.formToJson = function () {
    var param = {};
    var form = this;//.serializeArray();
    $('input[type=hidden],input[type=text],input[type=radio],input[type=checkbox],input[type=password],select,textarea', form).each(function () {
        if (this.type === 'radio' || this.type === 'checkbox') {
            if (this.checked) {
                param[this.name] = $(this).val();
            }
        } else {
            param[this.name] = $(this).val();
        }
    });
    return param;
};
var confirm = function (title, content, confirm, cancel) {
    var $confirm = $('#your-confirm');
    var $confirmBtn = $confirm.find('[data-am-modal-confirm]');
    var $cancelBtn = $confirm.find('[data-am-modal-cancel]');
    $confirmBtn.off('click.confirm.modal.amui').on('click', function () {
        confirm();
    });

    $cancelBtn.off('click.cancel.modal.amui').on('click', function () {
        cancel();
    });
};
var alert = function(title, content){
    $("#my-alert").find(".am-modal-hd").html(title);
    $("#my-alert").find(".am-modal-bd").html(content);
    $("#my-alert").modal();
};

